import 'package:safetymonitor/generated/json/base/json_convert_content.dart';
import 'package:safetymonitor/app/data/entities/home/company_and_system_entity.dart';

CompanyAndSystemEntity $CompanyAndSystemEntityFromJson(Map<String, dynamic> json) {
  final CompanyAndSystemEntity companyAndSystemEntity = CompanyAndSystemEntity();
  final int? companyId = jsonConvert.convert<int>(json['companyId']);
  if (companyId != null) {
    companyAndSystemEntity.companyId = companyId;
  }
  final String? companyName = jsonConvert.convert<String>(json['companyName']);
  if (companyName != null) {
    companyAndSystemEntity.companyName = companyName;
  }
  final int? systemId = jsonConvert.convert<int>(json['systemId']);
  if (systemId != null) {
    companyAndSystemEntity.systemId = systemId;
  }
  final String? systemName = jsonConvert.convert<String>(json['systemName']);
  if (systemName != null) {
    companyAndSystemEntity.systemName = systemName;
  }
  return companyAndSystemEntity;
}

Map<String, dynamic> $CompanyAndSystemEntityToJson(CompanyAndSystemEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['companyId'] = entity.companyId;
  data['companyName'] = entity.companyName;
  data['systemId'] = entity.systemId;
  data['systemName'] = entity.systemName;
  return data;
}

extension CompanyAndSystemEntityExtension on CompanyAndSystemEntity {
  CompanyAndSystemEntity copyWith({
    int? companyId,
    String? companyName,
    int? systemId,
    String? systemName,
  }) {
    return CompanyAndSystemEntity()
      ..companyId = companyId ?? this.companyId
      ..companyName = companyName ?? this.companyName
      ..systemId = systemId ?? this.systemId
      ..systemName = systemName ?? this.systemName;
  }
}